import './App.css'
import { Route, Routes } from 'react-router-dom'
import Layout from '@/pages/Layout'
import Login from '@/pages/Login'
import { AuthComponent } from '@/component/AuthComponent'
import Home from './pages/Home'
import Article from './pages/Article'
import Publish from './pages/Publish'
import { unstable_HistoryRouter as HistoryRouter } from "react-router-dom"
import { history } from './utils/history'
function App () {
  return (
    //路由配置
    <HistoryRouter history={history}>
      <div className="App">

        <Routes>
          {/* 创建路由path和组件对应关系 */}
          <Route path='/login' element={<Login />}>login</Route>
          {/* Layout需要鉴权处理 */}
          <Route path='/'
            element=
            {<AuthComponent>
              <Layout />
            </AuthComponent>
            }>
            <Route index element={<Home />}></Route>
            <Route path='/article' element={<Article />}></Route>
            <Route path='/publish' element={<Publish />}></Route>
          </Route>
          {/* 二级路由默认界面 */}

        </Routes>
      </div>
    </HistoryRouter>

  )
}

export default App
